const {merge} = require('webpack-merge');
const common = require("./webpack.common");
const path = require("path");
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;

// console.log("1212", process.env.NODE_ENV, env)
module.exports = (env) => {

    console.log("env", env.NODE_ENV);
    return merge(common, {
        mode: "development",
        devtool: 'eval-cheap-source-map', // development
        entry: {
            lodash: './index.js',
            main: './contnet.js',
        },
        output: {
            filename: '[name].bundle.js',
            path: path.resolve(__dirname, `dev`)
        },
        optimization: {
            usedExports: true,
            // splitChunks: {
            //     chunks: 'all',
            //     name: "vendor"
            // }
        },
        // plugins: [
        //     new BundleAnalyzerPlugin({
        //         analyzerMode: 'server',
        //         analyzerHost: 'localhost',
        //         analyzerPort: 8888,
        //         openAnalyzer: true
        //     })
        // ]

    })
}
